package com.snail.auth.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;

@ApiModel
@NoArgsConstructor
@Data
@Entity
@Table(name = "auth_menu")
public class AuthMenu implements Serializable {
    @ApiModelProperty(value = "为空则自动生成")
    @Id
    private Long id;
    @ApiModelProperty(value = "菜单名称")
    @Column(length = 30)
    private String name;
    @ApiModelProperty(value = "路由路径，对应vue-router的path")
    @Column(length = 30)
    private String path;
    @ApiModelProperty(value = "重定向路径")
    @Column(length = 30)
    private String redirect;
    @Column(length = 50)
    private String url;//组件地址，对应vue-router的 component
    @Column(length = 20)
    private String icon;

    private Long parentId;//父节点
    @Transient
    private String parentName;//父菜单名称
    private Integer sort;//顺序
    @ApiModelProperty(value = "状态标志位,默认0", hidden = true)
    @Column(columnDefinition = "int default 0")
    private Integer flag;
    @Column(length = 30)
    private String remark;//备注

    private Integer funStatus;//软件功能状态 0-正常 1-功能开发中 2-已废弃

    public AuthMenu(Long id, String name, Long parentId, String url) {
        this.id = id;
        this.name = name;
        this.parentId = parentId;
        this.url = url;
    }
}
